﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebBanThuoc.DAO;
using WebBanThuoc.DTO;
using WebBanThuoc.Server;

namespace WebBanThuoc
{
    public partial class ChiTietTin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session.Remove("tongSoTrang");
                getData();
            }
        }
        public void getData()
        {
            IServerWeb sw = new ServerWeb();
           TinTuc_DAO daoTT = new TinTuc_DAO(sw.Connection);

            int IDTinTuc=1;
            if (Request.Params["IDTinTuc"] != null)
                IDTinTuc = Convert.ToInt32(Request.Params["IDTinTuc"]);

            TinTuc tt = daoTT.getByKey(IDTinTuc);
            Session.Add("tt", tt);

            int MaDanhMuc = Convert.ToInt32(Request.Params["MaDanhMuc"]);   // tin tuc thuoc
            //list tin cung danh muc
            List<TinTuc> listTTTop = daoTT.getList_Top(MaDanhMuc);
         
            Session.Add("listTTTop", listTTTop);

            sw.closeConnection();
          
        }
    }
}